package cn.tedu.egmvc1.controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
public class EmpController {
   //http://localhost:8080/emp/add?name=王伟超&salary=30000&job=程序员
   @RequestMapping("/emp/add")
   @ResponseBody
    public String add(String name,Double salary,String job){
       System.out.println("员工姓名："+name+",工资："+salary+",岗位："+job);
       return "添加完成";
   }
   //http://localhost:8080/emp/list

   @RequestMapping("/emp/list")
   @ResponseBody
   public String list(){
      System.out.println("查询员工列表");
      return "查询成功";
   }
   //http://localhost:8080/emp/update?id=1&name=王伟超&salary=25000&job=程序员
   @RequestMapping("/emp/update")
   @ResponseBody
   public String update(int id,String name,Double salary,String job){
      System.out.println("员工编号："+id+",员工姓名："+name+",员工工资："+salary+",员工岗位："+job);
      return "修改完成";
   }






   //http://localhost:8080/emp/delete?id=1
   @RequestMapping("/emp/delete")
   @ResponseBody
   public String delete(Long id){
      System.out.println("删除员工："+id);
      return "删除成功";
   }



}
